# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=qxgedit
pkgver=0.9.9
pkgrel=1
pkgdesc="GUI for editing MIDI System Exclusive files for XG devices (eg. Yamaha DB50XG)"
arch=(loong64 x86_64)
url="https://qxgedit.sourceforge.io/"
license=(GPL2)
groups=(pro-audio)
depends=(
  gcc-libs
  glibc
  hicolor-icon-theme
  qt6-base
  qt6-svg
)
makedepends=(
  alsa-lib
  cmake
  qt6-tools
)
source=(https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz)
sha512sums=('742f01b25913a418776444000ceecf1f9e514585c7569de99b8dd7dcc763854963ef55664fd37f845cb74e316a779e15fe32d64d8d44a31b3cde5259f4485b95')
b2sums=('df43df86eb57a50f1b0d3c3b37f7708b3bb344b3425dc78aa4972b8019b38c46408ace515b96439aacc098c20d4666928b38ad9053041c8c55deb6c8336a2999')

build() {
  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CONFIG_QT6=ON
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

package() {
  depends+=(
    alsa-lib libasound.so
  )

  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname-$pkgver/{ChangeLog,README} -t "$pkgdir/usr/share/doc/$pkgname/"
}
